package cn.edu.lingnan.servlet;

import cn.edu.lingnan.service.IParticipationService;
import cn.edu.lingnan.service.IStudentService;
import jakarta.servlet.ServletException;
import jakarta.servlet.annotation.WebServlet;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;

import java.io.IOException;
@WebServlet("/resetPass")
public class resetPassword extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        String userId = req.getParameter("userId");

        IStudentService service = new IStudentService();
        boolean flag = service.resetPassword(userId);
        if(!flag){
            resp.sendRedirect("/resetPassError.html");
        }
        resp.sendRedirect(req.getContextPath()+"/index.html");
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        super.doPost(req, resp);
    }
}
